<!--
 * @Description: 文件描述,
 * @Version: 1.0
 * @Author: YueXuanzi
 * @Date: 2024-09-08 17:43:33
 * @LastEditors: YueXuanzi
 * @LastEditTime: 2024-10-06 21:34:00
 * @心得体会: 无
-->
<template>
    今日预约表
    <!-- 表格显示 -->
    <el-table :data="tableData" style="width: 100%" border height="60vh" highlight-current-row>
        <!-- <el-table-column fixed type="selection" width="50" /> -->
        <el-table-column prop="patientId" label="序号" width="80" align="center"></el-table-column>
        <el-table-column prop="name" label="姓名"  align="center"></el-table-column>
        <el-table-column prop="sex" label="性别"  align="center">
            <template v-slot="scope">
                <!-- 标签 -->
                <el-tag v-if="scope.row.sex == 1" type="success">男</el-tag>
                <el-tag v-else type="primary">女</el-tag>
            </template>
        </el-table-column>
        <el-table-column prop="profile" label="简介"  align="center"></el-table-column>
        <el-table-column prop="phonenumber" label="电话"  align="center"></el-table-column>
        <el-table-column prop="email" label="邮箱"  align="center"></el-table-column>
        <el-table-column label="操作"  align="center">
            <template #default="scope">
                <el-button type="primary" @click="toRegister(scope.row)">进行就诊</el-button>
            </template>
        </el-table-column>
    </el-table>
</template>

<script setup>
import { computed, ref, reactive } from 'vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import { getList } from "@/api/doctor/register.js"
import { useRouter } from 'vue-router'
// 表格数据
const tableData = ref([
    {id: 1, doctorImg: "@/assets/img/xx.png", doctorName: "张三", sex: "男", description: "我是一个好医生", phonenumber: "123456789", price: "100", status: 1},
    {id: 2, doctorImg: "@/assets/img/xx.png", doctorName: "张三", sex: "男", description: "我是一个好医生", phonenumber: "123456789", price: "100", status: 1},
    {id: 3, doctorImg: "@/assets/img/xx.png", doctorName: "张三", sex: "男", description: "我是一个好医生", phonenumber: "123456789", price: "100", status: 1}
])
// 初始化数据
initData()
// 初始化方法
function initData(){
    getList().then(res =>{
        console.log(res)
        // 初始化表格数据
        tableData.value = res.data
    })
}
const router = useRouter()
function toRegister(row){
    console.log("进行就诊")
    router.push({
         path:'/visit',
         query: row
         // 多个参数这样的写法
         // query:{Shuju}
     })
}

</script>

<style scoped>

</style>